package 测试类;

import java.util.Scanner;

public class test7 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int temp = 0;
		boolean flag = false;
		for (int i = 0; i < n; i++) {
			temp = sc.nextInt();
			for (int j = 2; j < temp ; j++) {
				if(temp % j == 0) {
					flag = true;
					break;
				}
			}
			if (flag){
				System.out.println("No");
			}else{
				System.out.println("Yes");
			}
			flag = false;
		}
	}
}
